﻿@namespace Microsoft.FluentUI.AspNetCore.Components
@inherits FluentNavMenuItemBase

@if (Visible)
{
    <CascadingValue TValue=INavMenuItemsOwner Value="@this" IsFixed>
     <CascadingValue Value="@HasChildIcons" Name="NavMenuItemSiblingHasIcon">
         <FluentTreeItem @ref=TreeItem
                         Id="@Id"
                         Class="@ClassValue"
                         Style="@StyleValue"
                         Disabled="@Disabled"
                         Selected="@Selected"
                         SelectedChanged="@HandleSelectedChangedAsync"
                         Expanded="@Expanded"
                         ExpandedChanged="@SetExpandedAsync"
                         Text="@Text">
                @if (HasIcon)
                {
                    <FluentIcon Value="@Icon" Width="@(ICON_WIDTH)" Slot="start" />
                }
                else if (SiblingHasIcon)
                {
                    <span style="width: @ICON_WIDTH;" slot="start"></span>
                }
                @if (GetShouldRenderChildContent())
                {
                    @ChildContent
                }
            </FluentTreeItem>
        </CascadingValue>
    </CascadingValue>
}